#ifndef _TEVENTLOOP_H_
#define _TEVENTLOOP_H_
#include <map>
#include <vector>
#include "TNoCopyable.h"
#ifdef WIN32
#include <windows.h>
#else
#include <sys/epoll.h>
#define MAX_EVENTS 1024
#endif

class TSocket;
class TServer;
class TEventLoop : TNoCopyable
{
public:
    TEventLoop();
    virtual ~TEventLoop();

    bool AddLoop(TSocket* sock);
    bool DelLoop(TSocket* sock);
    void RunLoop(TServer* server);
private:
#ifdef WIN32
    std::map<int, TSocket*> cliMap;
    fd_set connSet_, sendSet_, recvSet_;
#else
    int epollfd_;
    struct epoll_event ev_, events_[MAX_EVENTS];
#endif
};


#endif